Interrupt handling techniques in the rasterizer of a GPU

ABSTRACT

Techniques for handling an interrupt in the rasterizer, in accordance with embodiment of the present technology, start with rasterizing one or more primitives of a first context. If an interrupt is received, the tile count of tiles of a current primitive that have been coarse rasterized is saved in a backing store. After storing the tile count, the one or more primitives of a second context are rasterized. After the second context is served, the coarse rasterization of the current primitive of the previous context is rerun without output until the tile corresponding to the stored tile count is coarse rasterized. Thereafter, rasterization of the current primitive of the first context from the next tile beyond the stored tile count is continued until rasterization is completed or another interrupt is received and the above described process is repeated.

BACKGROUND OF THE INVENTION

Recent advances in computer performance have enabled graphic systems to provide more realistic graphical images using personal computers, home video game consoles, handheld devices, and the like. In such graphic systems, a number of procedures are executed to “render” or draw graphic primitives to the screen of the system. A “graphic primitive” is a basic component of a graphic picture, such as a point, line, polygon, or the like. Rendered images are formed with combinations of these graphic primitives. Many procedures may be utilized to perform 3-D graphics rendering.

Specialized graphics processing units (e.g., GPUs, etc.) have been developed to optimize the computations required in executing the graphics rendering procedures. The GPUs are configured for high-speed operation and typically incorporate one or more rendering pipelines. Each pipeline includes a number of hardware-based functional units that are optimized for high-speed execution of graphics instructions/data, where the instructions/data are fed into the front end of the pipeline and the computed results emerge at the back end of the pipeline. The hardware-based functional units, cache memories, firmware, and the like, of the GPU are optimized to operate on the low-level graphics primitives (e.g., comprising “points”, “lines”, “triangles”, etc.) and produce real-time rendered 3-D images.

The rendered images are generated using raster display technology. Raster display technology is widely used in computer graphics systems, and generally refers to the mechanism by which the grid of multiple pixels comprising an image are influenced by the graphics primitives. For each primitive, a typical rasterization system determines whether or not to “render,” or write a given pixel into a frame buffer or pixel map, as per the contribution of the primitive. This, in turn, determines how to write the data to the display buffer representing each pixel.

Once the primitives are rasterized into their constituent pixels, these pixels are then processed in pipeline stages subsequent to the rasterization stage where the rendering operations are performed. Generally, these rendering operations assign a color to each of the pixels of a display in accordance with the degree of coverage of the primitives comprising a scene. The per pixel color is also determined in accordance with texture map information that is assigned to the primitives, lighting information, and the like.

FIG. 1 shows an exemplary implementation of graphics processing unit (GPU) 100. The process performed by the GPU generally includes setting up a polygon model (e.g., a plurality of primitives) of objects, applying linear transformation to each primitive, culling back facing primitives, clipping the primitives against a view volume, rasterizing the primitives to a pixel coordinate set, shading/lighting the individual pixels using interpolated or incremental shading techniques, and the like. Accordingly, the GPU 100 hardware includes a setup engine 110, a raster pipeline 120, a shading pipeline 130, a data write unit 140, and one or more other units.

It is sometimes desirable to interrupt the graphics processing in the GPU to serve a different process. Referring now to FIG. 2, a method of handling interrupts in the raster pipeline according to the conventional art is shown. At 210 a current primitive of a first process is rasterized. Before or after one or more primitives are rasterized, a check is performed to determine if an interrupt has been received, at 220. If an interrupt has not been received, the method continues with rasterizing the next primitive of the first process, at 210.

If an interrupt has been received at 230, rasterization of the first process is stopped and the rasterizer serves a second process at 240. When servicing of the second process is completed, the method continues with rasterizing the next primitive of the first process at 210. If rasterization of the current primitive, particularly in the coarse rasterizer, is run until it is completed it could take an unacceptably long time before the second process is served.

SUMMARY OF THE INVENTION

As computers continue to advance there is a continuing need for improvements in the graphics processing unit (GPU). Embodiments of the present technology are directed toward interrupt handling techniques in the rasterizer of the GPU. In one embodiment, a method of handling an interrupt in a rasterizer includes starting rasterization of a first process. Periodically, a check is performed to determine if an interrupt is received during coarse rasterization of the current primitive. If an interrupt is not received, rasterization of the current primitive continues until it is completed. If an interrupt is received, the tile count of the current primitive is saved. A second process corresponding to the interrupt is then serviced after the tile count of the first process is saved. After the second process is serviced, the coarse rasterization of the first process is rerun without output until the tile corresponding to the saved tile count is coarse rasterized. Rasterization is then continued from the next tile beyond the halt point tile count until rasterization is completed.

In another embodiment, a graphics processing unit includes a rasterizer having an interrupt handler and a backing store. The rasterizer determines which pixels of a display screen are touched by a primitive. During coarse rasterization of tiles of a primitive, the interrupt handler is adapted to receive an interrupt and save a tile count, of the last tile of the current primitive coarse rasterized, in the backing store in response to the interrupt. The interrupt handler is also adapted to rerun coarse rasterization of the current primitive without output until the tile corresponding to the stored tile count is coarse reasterized after serving another context in response to the interrupt. Thereafter, rasterization of the original process can be completed.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the present technology are illustrated by way of example and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:

FIG. 1 shows a block diagram of a graphics processing unit according to the conventional art.

FIG. 2 shows a flow diagram of a method of handling interrupts in the raster pipeline according to the conventional art.

FIG. 3 shows a flow diagram of a method of handling interrupts in the raster pipeline, in accordance with one embodiment of the present technology.

FIG. 4 shows an exemplary coarse rasterization of a primitive, in accordance with one embodiment of the present technology.

FIG. 5 shows a flow diagram of a method of handling interrupts in the raster pipeline, in accordance with another embodiment of the present technology.

FIG. 6 shows a block diagram of a graphics processing unit, in accordance with one embodiment of the present technology.

FIG. 7 shows a block diagram of exemplary computing device architecture for implementing embodiments of the present technology.

DETAILED DESCRIPTION OF THE INVENTION

Reference will now be made in detail to the embodiments of the present technology, examples of which are illustrated in the accompanying drawings. While the present technology will be described in conjunction with these embodiments, it will be understood that they are not intended to limit the invention to these embodiments. On the contrary, the invention is intended to cover alternatives, modifications and equivalents, which may be included within the scope of the invention as defined by the appended claims. Furthermore, in the following detailed description of the present technology, numerous specific details are set forth in order to provide a thorough understanding of the present technology. However, it is understood that the present technology may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the present technology.

As computers continue to advance it is desirable to reduce the amount of time that it takes to service an interrupt request. The raster pipeline, and in particular the coarse rasterizer, of the graphics processing unit (GPU) may regularly process large primitives that cover a large number of tiles and/or pixels. Currently, it may take a few milliseconds (ms) to a few hundred milliseconds to process a large primitive, particularly on a large display screen with a relatively high resolution. Therefore, it currently takes a few milliseconds to a few hundred milliseconds to handle an interrupt in the rasterizer of the GPU. However, in the future it may be desirable to be able to switch contexts in response to an interrupt within a shorter amount of time than is required to complete the coarse rasterization of an entire primitive. In the future it is expected that it will be desirable to handle interrupts in a few millisecond to tens-of-microseconds or less.

Embodiments of the present technology include techniques for interrupting the graphics processing in a GPU to serve a different process. The techniques include context save and context replay. Upon receipt of an interrupt, context save embodiments store the state of the rasterizer at the end of coarse rasterizing a current tile of a current primitive. The incremental data and intermediate results data are saved to a backing store where they can be reloaded upon restart of the given context. Replay embodiments involve saving only the count of tiles that have already been coarse rasterized for the current primitive. After servicing another process, the coarse rasterization is then rerun without output until the coarse rasterizer is ready to produce the next tile beyond the halt point. The context save and context replay embodiments both produce a quicker interrupt response, as compared to conventional interrupt handling techniques.

Referring now to FIG. 3, a context save method of handling interrupts in the raster pipeline, in accordance with one embodiment of the present technology, is shown. The context save method will be also explained with reference to FIG. 4, which illustrates an exemplary coarse rasterization of a primitive 410. During coarse rasterization, the tiles approximating the primitive are traversed to determine which tiles are “touched” by the primitive. Various traversal algorithms have been developed for converting from the graphics primitive based description to a pixel based description. As illustrated, the tiles 420 are 2×2 groups of pixels. However, the tiles may be of any size, may be square groups, rectangular groups, non-rectangular groups or a combination of one or more group types. The coarse rasterization proceeds in a predetermined traversal order. In a unidirectional traversal order a group of tiles are coarse rasterized row-by-row in a constant direction. When the end of a row is reached the sequence shifts across the primitive to a starting location on a first side of the primitive. In a boustrophedonic traversal order, illustrated by the arrowed lines in FIG. 4, each tile is traversed by scanning back and forth along a predominant axis. As each pass moves farther along on the orthogonal axis in a serpentine pattern, that folds back and forth along the predominant axis. The boustrophedonic traversal pattern ensures that an average distance from a generated tile to the previously generated tiles is relatively small.

At 310, coarse rasterization of a current primitive of a first process (e.g., context) is started. Coarse rasterization determines which tiles of a screen area are related to a given graphics primitive by determining if the primitive touches a current tile as the group of tiles are traversed. As illustrated in FIG. 4, the solid portion of the traversal order 430 indicates the tiles that have already been coarse rasterized, the light shaded tile 440 represents the current tile being coarse rasterized, and the dashed portion of the traversal order 450 indicates the tiles that have not been coarse rasterized yet. Periodically during coarse rasterization of each primitive, a check is performed to determine if an interrupt has been received, at 320. The interrupt check may be performed one or more times during the coarse rasterization of the current primitive of the first process. For example, the interrupt check may be performed after each tile is coarse rasterized, or after each set of a predetermined number of tiles (e.g., every ten tiles) are coarse rasterized. If an interrupt has not been received, the method continues with coarse rasterizing the current primitive of the first process until it is completed, at 330. The method then continues by starting coarse rasterization of the next primitive at 310.

If an interrupt has been received at 340, the state of the rasterizer is saved to a backing store at 350. The saved raster state information in the backing store may include incremental data and intermediate data results, such as the last tile processed, the traversal order, the traversal limits, the bounds of the primitive, the traversal direction, the description of the edges bounding the primitive, the current distance from those edges, the plane of the primitive and the current depth of the plane, and/or the like. It may not, however, be necessary to save state information such as the number of tiles selected/produced thus far when saving the full state. The state of the rasterizer is saved at the end of coarse rasterizing the current tile of the current primitive when the interrupt was determined, which is referred to as the halt point. In another implementation, the halt point may be after processing of a predetermined interval of tiles (e.g., every ten tiles) which occurs after the interrupt was determined. The rasterizer serves a second process at 360, after the raster state of the first process is stored. When servicing of the second process is completed, the raster state of the first process including incremental data and intermediate results are restored from the backing store, at 370. After the state of the first process is restored, rasterization of the current primitive of the first process is continued until it is completed, at 330. The first process is continued from the last tile processed before the interrupt halted the first process. The method then continues by starting rasterization of the next primitive at 310.

Referring now to FIG. 5, a replay method of handling interrupts in the raster pipeline, in accordance with one embodiment of the present technology, is shown. At 510, rasterization of a current primitive of a first process (e.g., context) is started. Periodically during coarse rasterization of each primitive, a check is performed to determine if an interrupt has been received, at 520. The interrupt check may be performed one or more times during the coarse rasterization of the current primitive of the first process. If an interrupt has not been received, the method continues with rasterizing the current primitive of the first process until it is completed, at 530. The method then continues by starting rasterization of the next primitive at 510.

If an interrupt has been received at 540, the count of tiles produced up to the halt point is stored to a backing store at 550. The halt point is the current tile of the current primitive that was processed before receipt of the interrupt was determined. Alternatively, the rasterization of the current primitive of the first process stops after coarse rasterization of a predetermined interval of tiles. In such an implementation, the tile count corresponds to the last tile in the predetermined interval of tiles that was coarse rasterized before rasterization of the current process stopped in response to the received interrupt. The rasterizer serves a second process at 560, after the tile count is stored. When servicing of the second process is completed, the tile count is retrieved from the backing store and coarse rasterization of the first process is rerun without output until the coarse rasterizer is ready to produce the next tile beyond the tile count, at 570. After the coarse rasterization of the first process is rerun without output, rasterization of the current primitive of the first process is continued until it is completed, at 530. By rerunning the coarse rasterization without output, the incremental data and intermediate data results needed to continue coarse rasterizing the tiles that were not processed yet are generated. The method then continues by starting rasterization of the next primitive at 510.

Referring now to FIG. 6, an exemplary graphics processing unit (GPU) 600, in accordance with one embodiment of the present technology, is shown. The process performed by the GPU 600 generally includes setting up a polygon model (e.g., a plurality of primitives) of objects, applying linear transformation to each primitive, culling back facing primitives, clipping the primitives against a view volume, rasterizing the primitives to a pixel coordinate set, shading/lighting the individual pixels using interpolated or incremental shading techniques, and the like. Accordingly, the GPU 600 typically includes a setup engine 610, a raster pipeline 620, a shading pipeline 630, a data write unit 640, and one or more other units.

The raster pipeline 620 includes a coarse rasterizer 621, a fine rasterizer 623, an edge evaluator 625 and one or more other circuits. The coarse rasterizer determines which tiles of pixels are touched by each primitive of an image to be rendered. The coarse rasterizer includes an interrupt handler 627 and a backing store 629. The interrupt handler 627 receives interrupts, and saves the state of the rasterizer in response to receipt of an interrupt. The interrupt handler 627 also restores the state of the rasterizer after serving another context in response to receipt of an interrupt. The backing store 629 is utilized by the interrupt handler 627 to store the state information of the rasterizer. The interrupt handler 627 may be implemented as software, firmware, hardware or a combination thereof. In one implementation, the interrupt handler 627 may be implemented in one or more computing device readable media containing a plurality of instructions which when executed cause the rasterizer to receive the interrupt, save the state of the rasterizer at the end of coarse rasterizing the current tile of the current primitive in response to an interrupt, and restore the state of the rasterizer after serving another context. The backing store 629 may be implemented as one or more computing device readable media (e.g., cache) for storing the state of the rasterizer.

Alternatively, the interrupt handler 627 receives interrupts, and saves a tile count of the last tile of the current primitive that was coarse rasterized. The interrupt handler 627, after servicing another context, in response to receipt of an interrupt, also reruns coarse rasterization of the first context without output until the tile corresponding to the stored tile count is coarse rasterized. The backing store 629 is utilized by the interrupt handler 627 to store the tile count.

The fine rasterizer 623 determines which pixels in the tiles touch the primitive, for those tiles that the coarse rasterizer 621 determined to touch a primitive. The edge evaluator 625 computes the edge equation, Ax+By+C>0, for all samples, x and y, and all edges of each primitive, to determine which pixels are touched by an edge of the primitive.

Referring now to FIG. 7, an exemplary computing device 700 for implementing embodiments of the present invention is shown. The computing device 700 may be a personal computer, server computer, client computer, laptop computer, game console, hand-held device, minicomputer, mainframe computer, distributed computer system, embedded computer, system on a chip, or the like. In addition to standard computers, the computing device may be used to implement car dashboards, kiosks, pachinko machines, slot machines, television sets, industrial controls, medical devices, wearable devices embedded in clothing, eyeglasses or wristbands, and other such applications. The computing device 700 includes one or more central processing units (CPU) 710, one or more graphics processing units (GPU) 720, an input/output hub 730, one or more computing device-readable media 740, 750, a display device 760, and one or more other input/output (I/O) devices (not shown). The additional I/O devices may include a network adapter (e.g., Ethernet card), CD drive, DVD drive, a keyboard, a pointing device, a speaker, a printer, and/or the like.

The computing device-readable media 740, 750 may be characterized as primary memory and secondary memory. Generally, the secondary memory, such as magnetic storage, optical storage and/or holographic storage, provides for non-volatile storage of computer-readable instructions and data for use by the computing device 700. For instance, a disk drive may store the operating system (OS) and applications and data. The primary memory, such as system memory and/or graphics memory 750, provides for volatile storage of computer-readable instructions and data for use by the computing device 700. For instance, the system memory may temporarily store a portion of the operating system and a portion of one or more applications and associated data that are currently used by the CPU 710, GPU 720 and the like.

The computing device-readable media 740, 750, I/O devices 760, and GPU 720 may be communicatively coupled to the processor 710 by the input/output hub 730 and one or more busses. The input/output hub 730 may be a simple hub or a chip set, such as a northbridge and southbridge. The input/output hub 730 provides for communication of data and instructions between the processor 710 and the computing device-readable media 740, 750, I/O devices 760, and GPU 720. In the case of a northbridge/southbridge chip set, the northbridge 170 provides for communication with the processors 710, 720 and interaction with the system memory. The southbridge 175 provides for general input/output functions.

The GPU 720 may include a setup engine, a raster pipeline, a shading pipeline, a data write unit, and one or more other units, as illustrated and described with reference to FIG. 6. The raster pipeline of the GPU 720 includes a coarse rasterizer having an interrupt handler and a backing store. The interrupt handler and backing store may implement a context save or context replay interrupt handling technique in the rasterizer. Upon receipt of an interrupt, context save embodiments involve saving the state of the rasterizer after coarse rasterizing a current tile of a current primitive. Incremental data and intermediate results data are saved to a backing store where they can be recovered and reloaded upon restart of the given context. Replay embodiments involves saving only the count of the last tile that has been coarse rasterized for the current primitive. The rasterization is then rerun without output until the coarse rasterizer is ready to produce the next tile beyond the halt point.

Context save and context replay interrupt handling each produce a quicker interrupt response, as compared to conventional interrupt handling techniques. Furthermore, the context save interrupt handling advantageously produces a quicker recovery response than replay, at the expense of substantial state storage. In contrast, the replay interrupt handling advantageously produces a quick halt response and requires a smaller amount of state storage but results in a longer recovery process, as compared to context save.

The foregoing descriptions of specific embodiments of the present technology have been presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed, and obviously many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the present technology and its practical application, to thereby enable others skilled in the art to best utilize the present technology and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the Claims appended hereto and their equivalents. 

What is claimed is:
 1. A method of handling an interrupt in a rasterizer comprising: starting coarse rasterization of a current primitive of a first process to determine which pixels of a display screen are related to the current primitive; determining, during coarse rasterization of the current primitive, if an interrupt is received; continuing coarse rasterization of the current primitive until it is completed, if the interrupt is not received; storing a tile count of the current primitive of the first process corresponding to a halt point, if the interrupt is received during coarse rasterization of the current primitive; servicing a second process corresponding to the interrupt after the count of the current tile rasterized of the current primitive of the first process is saved; rerunning coarse rasterization of the current primitive, after servicing the second process, without output until the tile corresponding to the halt point tile count is rasterized; and continuing coarse rasterization of the current primitive with output, after rerunning coarse rasterization of the current primitive, from the next the beyond the halt point tile count until coarse rasterization of the current primitive is completed.
 2. The method according to claim 1, further comprising periodically checking for the interrupt during coarse rasterization of the current primitive.
 3. The method according to claim 2, wherein periodically checking for the interrupt comprises determining if the interrupt is received after coarse rasterization of each tile of the current primitive.
 4. The method according to claim 2, wherein periodically checking for the interrupt comprises determining if the interrupt is received after coarse rasterization of each set of a predetermined number of tiles of the current primitive.
 5. The method according to claim 1, wherein the rasterization comprises determining which tiles the current primitive touches.
 6. The method according to claim 1, wherein the halt point corresponds to a current coarse rasterized tile when the interrupt is received.
 7. The method according to claim 1 wherein the halt point corresponds to a last coarse rasterized tile in a predetermined interval of tiles after the interrupt is received.
 8. One or more non-transitory computing device readable media containing a plurality of instructions which when executed cause a computing device to implement a method comprising: rasterizing one or more primitives of a first context; storing a tile count of tiles of a current primitive of the one or more primitives of the first context that have been coarse rasterized, if an interrupt is received during, coarse rasterizing of the current primitive; rasterizing one or more primitives of a second context in response to the received interrupt after storing the tile count; rerunning coarse rasterization of the current primitive of the first context without output until the tile corresponding to the stored tile count is coarse rasterized, after the second context is served; and continuing rasterization of the current primitive of the first context from the next tile beyond the stored tile count until rasterization is completed, after the second context is served.
 9. The one or more non-transitory computing device readable media containing a plurality of instructions which when executed cause a computing, device to implement the method according to claim 8, further comprising periodically checking for the interrupt during coarse rasterization of the current primitive of the first context.
 10. The one or more non-transitory computing device readable media containing a plurality of instructions which when executed cause a computing device to implement the method according to claim 9, wherein periodically checking for the interrupt comprises determining if the interrupt is received after coarse rasterization of each tile.
 11. The one or more non-transitory computing device readable media containing a plurality of instructions which when executed cause a computing device to implement the method according to claim 9, wherein periodically checking for the interrupt comprises determining if the interrupt is received after coarse rasterization of each set of a predetermined number of tiles.
 12. The one or more non-transitory computing device readable media containing a plurality of instructions which when executed cause a computing device to implement the method according to claim 8, wherein rasterization of the one or more primitives of a first context stops at a current tile of the first context and rasterizing one or more primitives of a second context in response to the received interrupt starts after raster of the current tile of the first context.
 13. The one or more non-transitory computing device readable media containing a plurality of instructions which when executed cause a computing device to implement the method according to claim 8, wherein rasterization of the one or more primitives of a first context stops after coarse rasterization of a predetermined interval of tiles of the first context and rasterizing one or more primitives of a second context in response to the received interrupt starts after coarse rasterization of the predetermined interval of tiles of the first context.
 14. A graphics processing unit comprising: a rasterizer for determining which pixels of a display screen are touched by a primitive, wherein the rasterizer includes; a coarse rasterizer for determining a set of tiles that touch a current primitive; an interrupt handier for receiving an interrupt, saving a tile count of a last tile of the current primitive coarse rasterized in response to receiving the interrupt during coarse rasterizing the current primitive, and rerunning coarse rasterization of the current primitive without output until the tile corresponding to the stored tile count is rasterized after serving another context in response to receiving the interrupt; and a backing store for storing the tile count.
 15. The graphics processing unit of claim 14, further comprising a fine rasterizer coupled to the coarse rasterizer, wherein the fine rasterizer determines which pixels, of the set of tiles, touch the current primitive.
 16. The graphics processing unit of claim 15, further comprising an edge evaluator coupled to the fine rasterizer, wherein the edge evaluator determines which of the pixels touch an edge of the current primitive.
 17. The graphics processing unit of claim 14, wherein the interrupt handler comprises one or more computing device readable media containing a plurality of instructions which when executed operate to receive the interrupt, save the tile count of the last tile of the current primitive coarse rasterized, and rerun coarse rasterization of the current primitive without output until the tile corresponding to the stored tile count is coarse rasterized after serving another context.
 18. The graphics processing unit of claim 14, wherein the backing store comprises one or more computing device readable media for storing the tile count. 